// import { ReactNode, Suspense } from 'react'
import { RouteObject } from 'react-router-dom'
import Home from '@/pages/home'
import MenuLayout from '@/layouts/menu'

// 实现懒加载的用Suspense包裹
// const lazyLoad = (children: ReactNode): ReactNode => {
//   return <Suspense fallback={<h1>Loading...</h1>}>{children}</Suspense>
// }

const routes: RouteObject[] = [
  {
    path: '/',
    element: <Home />,
  },
  {
    path: '/menu',
    element: <MenuLayout />, // 切换页面会出现闪屏现象，公共页面不采用懒加载的方式，并在App.tsx去除Suspense的包裹
    // children: [
    //   {
    //     path: '/customer-service',
    //     // element: lazyLoad(<CustomerService />),
    //   },
    // ],
  },
]

export default routes
